package dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import dao.BaseDao;
import dao.Mogujie_product_categoryDao;
import entity.Mogujie_product_category;

public class Mogujie_product_categoryDaoImpl extends BaseDao implements Mogujie_product_categoryDao {
	
	ResultSet rs = null;
	@Override
	public List<Mogujie_product_category> getAllProduct() {
		String sql = "select * from mogujie_product_category";
		List<Mogujie_product_category> list = new ArrayList<Mogujie_product_category>();
		Mogujie_product_category category= null;
		Object [] param = {};
		rs = this.execute(sql, param);
		try {
			while(rs.next()) {
				category = new Mogujie_product_category();
				category.setId(rs.getInt("id"));
				category.setName(rs.getString("name"));
				category.setParentId(rs.getInt("parentId"));
				category.setType(rs.getInt("type"));
				category.setIsonClass(rs.getString("iconClass"));
				list.add(category);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
}
